/*
ID: ning yusui
LANG:C++
TASK:fence
*/
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cstring>
using namespace std;
const int SIZE = 501;
int edgeCount[SIZE],dij[SIZE][SIZE];

int findNext(int v)
{
    for (int i=1;i<SIZE;i++)
    {
        if (dij[v][i]>0)
        {
            dij[v][i]--;
            dij[i][v]--;
            edgeCount[v]--;
            edgeCount[i]--;
            return i;
        }
    }
    return 0;
}
int findStart()
{
    for (int i = 1; i < SIZE; i++)
    {
        if (edgeCount[i] % 2 == 1)
        {
            return i;
        }
    }
    return 1;
}

int main()
{
    ifstream fin("fence.in");
    ofstream fout("fence.out");
    memset(edgeCount,0,sizeof(edgeCount));
    memset(dij,0,sizeof(dij));
    int f;
    fin>>f;
    for (int i=1;i<=f;i++)
    {
        int x,y;
        fin>>x>>y;
        dij[x][y]++;
        dij[y][x]++;
        edgeCount[x]++;
        edgeCount[y]++;
    }
    int start = findStart();
    fout<<(start)<<'\n';
    while (edgeCount[start]>0)
    {
        start = findNext(start);
        fout<<(start)<<'\n';
    }
    return 0;
}
